<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
      * {
        margin: 0;
        padding: 0;
      }
      body {
        display: flex;
        justify-content: center;
        align-items: center;
        height: 100vh;
        background-color: skyblue;
      }
      #box {
        color: hotpink;
        font-size: 60px;
      }
    </style>
  </head>
  <body>
    <div id="box"></div>
    <script>
      setInterval(() => {
        let date = new Date()
        let year = date.getFullYear()
        let month = date.getMonth() + 1
        month = month < 10 ? '0' + month : month
        let day = date.getDate()
        day = day < 10 ? '0' + day : day
        let hour = date.getHours()
        let minute = date.getMinutes()
        minute = minute < 10 ? '0' + minute : minute
        let sconds = date.getSeconds()
        sconds = sconds < 10 ? '0' + sconds : sconds
        document.querySelector(
          '#box'
        ).innerHTML = `${year}-${month}-${day} ${hour}:${minute}:${sconds}`
      }, 1000)
    </script>
  </body>
</html>
